package com.example.demoback.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.example.demoback.common.Constants;
import com.example.demoback.controller.dto.PasswordDto;
import com.example.demoback.entity.People1;
import com.example.demoback.exception.ServiceException;
import com.example.demoback.mapper.People1Mapper;
import com.example.demoback.mapper.PeopleMapper;
import com.example.demoback.service.IPeople1Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author yyd
 * @since 2022-07-01
 */
@Service
@DS("slave_1")
public class People1ServiceImpl extends ServiceImpl<People1Mapper, People1> implements IPeople1Service {

    @Resource
    private People1Mapper people1Mapper;

    @Override
    public void updatePassword(PasswordDto passwordDto) {
        int update = people1Mapper.updatePassword(passwordDto);
        if (update < 1) {
            throw new ServiceException(Constants.CODE_600, "密码错误");
        }
    }

}
